package com.company.anr.model;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;

public class AnalysisRequest {

  @NotBlank(message = "设备SN不能为空")
  //匹配两种机器，一种以7开头的学习机，一种以A开头的学练机
  @Pattern(regexp = "^(7\\d{17}|(A010|A020)\\d{14})$", message = "SN格式不正确")
  private String deviceSn;

  @NotBlank(message = "手机号不能为空")
  private String phone;

  @NotBlank(message = "用户名不能为空")
  private String username;

  @NotBlank(message = "密码不能为空")
  private String password;

  // Constructors
  public AnalysisRequest() {
  }

  public AnalysisRequest(String deviceSn, String phone, String username, String password) {
    this.deviceSn = deviceSn;
    this.phone = phone;
    this.username = username;
    this.password = password;
  }

  // Getters and Setters
  public String getDeviceSn() {
    return deviceSn;
  }

  public void setDeviceSn(String deviceSn) {
    this.deviceSn = deviceSn;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  @Override
  public String toString() {
    return "AnalysisRequest{" +
        "deviceSn='" + deviceSn + '\'' +
        ", phone='" + phone + '\'' +
        ", username='" + username + '\'' +
        '}';
  }
}
